/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jmodcog2.fwd.convolve;

import jmodcog2.fwd.SupervisedNet;

/**
 *
 * @author Mitch
 */
public class UntrainedConvolveNet extends SupervisedNet {

    @Constant
    protected final int[] convolve_size;
    @Constant
    protected final int[] step_size;

    public UntrainedConvolveNet(ConvolveConfig config) {
        super(config);
        this.convolve_size = config.createConvolveSize();
        this.step_size = config.createStepSize();
    }
    
    
    @Override
    protected int _conn_index(int layer_i, int node_i, int node_j) {
        int i = 0;
        int step = 0;
        step = step_size[layer_i];
        i = node_i - node_j * step;
        if (i >= 0 && i < step) {
            if (shared_conn) {
                return conns_index0[layer_i] + i;
            } else {
                return conns_index0[layer_i] + node_j * convolve_size[layer_i] + i;
            }
        }
        return -1;
    }
}
